{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/permutations\n",
    "\n",
    "\n",
    "Runtime: 16 ms, faster than 8.91% of C++ online submissions for Permutations.\n",
    "Memory Usage: 10 MB, less than 6.96% of C++ online submissions for Permutations.\n",
    "\n",
    "\n",
    "```cpp\n",
    "#include <vector>\n",
    "\n",
    "using namespace std;\n",
    "\n",
    "class Solution {\n",
    "public:\n",
    "    vector<vector<int>> result;\n",
    "    vector<vector<int>> permute(vector<int>& nums) {\n",
    "        vector<int> v;\n",
    "        next(nums, v);\n",
    "        return result;\n",
    "    }\n",
    "    void next(vector<int> v, vector<int> r) {\n",
    "        if (v.size() == 0) {\n",
    "            result.push_back(r);\n",
    "        } else {\n",
    "            for (int i=0; i<v.size(); i++) {\n",
    "                vector<int> nV = v;\n",
    "                vector<int> nR = r;\n",
    "                int theValue = nV[i];\n",
    "                nV.erase(nV.begin() + i);\n",
    "                nR.push_back(theValue);\n",
    "                next(nV, nR);\n",
    "            }\n",
    "        }\n",
    "    }\n",
    "};\n",
    "```\n",
    "\n",
    "Awesome! I just implemented python's built-in modules function."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "C++17",
   "language": "C++17",
   "name": "xcpp17"
  },
  "language_info": {
   "codemirror_mode": "text/x-c++src",
   "file_extension": ".cpp",
   "mimetype": "text/x-c++src",
   "name": "c++",
   "version": "17"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
